<!-- 修改密码输入原密码头部组件 -->
<template>
  <view class="navigation-bar">
    <view class="left" @click="handleLeftClick">
      <u-icon name="arrow-left" size="40rpx"></u-icon>
    </view>
    <view class="title">{{ title }}</view>
    <view class="right" @click="handleClickRight">{{ rightText }}</view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    leftText: {
      type: String,
      default: '返回'
    },
    rightText: {
      type: String,
      default: ''
    },
	item: {
		type: String,
		default: ''
	}
  },
  methods: {
    handleLeftClick() {
      uni.navigateBack();
    },
    handleClickRight() {
      console.log(this.item)
	  const form=JSON.parse(this.item)
	  		  var ths = this;
	  		  uni.request({
	  		  	url: 'http://127.0.0.1:17000/AppCoach/encryption',
	  		  	method: 'GET',
	  		  	data: {
	  		  		word: form.oldPassword,
	  				myWord:form.coachPassword
	  		  	},
	  		  	success: function(res) {
	  		  		if (res.data.code == 200) {
	  					uni.navigateTo({
	  						url:'/pages/Pesonal/Up?item='+JSON.stringify(form)
	  					})
	  		  		} else {
	  		  			uni.showModal({
	  		  				title: "系统提示",
	  		  				content: "请输入正确的原密码",
	  		  				showCancel: false,
	  		  				confirmText: "确定"
	  		  			});
	  		  		}
	  		  
	  		  	},
	  		  	fail: function(error) {
	  		  		// 处理请求失败
	  		  		console.error('请检查网络');
	  		  	}
	  		  })
	  
    }
  }
};
</script>

<style>
/* 根据需求添加样式 */
.navigation-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  margin-top: 2vh;
  padding: 0 16px;
}

.left, .right {
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}
</style>